const { defineConfig } = require("@vue/cli-service");
const AutoImport = require("unplugin-auto-import/webpack");
const Components = require("unplugin-vue-components/webpack");
const { ElementPlusResolver } = require("unplugin-vue-components/resolvers");

module.exports = defineConfig({
  transpileDependencies: false,
  devServer: {
    port: 10085,
    open: true,
    host: "localhost",
    proxy: {
      "/crossDomainApi": {
        target: process.env.VUE_APP_BASE_URL,
        changeOrigin: true,
        secure: false,
        pathRewrite: {
          "^/crossDomainApi": "",
        },
      },
    },
    historyApiFallback: true,
  },
  productionSourceMap: false,
  configureWebpack: {
    // devtool: "inline-source-map",
    plugins: [
      AutoImport({
        resolvers: [ElementPlusResolver()],
      }),
      Components({
        resolvers: [ElementPlusResolver()],
      }),
    ],
  },
  chainWebpack: (config) => {
    config.plugin("html").tap((args) => {
      args[0].title = "贸融巡库";
      return args;
    });
  },
  publicPath: "./",
});
